package com.work.straighttalk.presenter;

import android.net.Uri;

import com.work.straighttalk.bean.Contact;
import com.work.straighttalk.model.ContactsDBDataMImpl;
import com.work.straighttalk.model.i.LoadDBDataMI;
import com.work.straighttalk.presenter.i.LoadDataPresenterI;
import com.work.straighttalk.presenter.i.OnLoadFinishedListener;
import com.work.straighttalk.ui.i.BindDataVI;

import java.util.List;

/**
 * Created by dllo on 16/3/18.
 */
public class ContactMesEditorPImpl implements LoadDataPresenterI<Uri>, OnLoadFinishedListener<List<Contact>> {
    private BindDataVI<Contact> bindDataVI;
    private LoadDBDataMI<List<Contact>> loadDBDataMI;

    public ContactMesEditorPImpl(BindDataVI<Contact> bindDataVI) {
        this.bindDataVI = bindDataVI;
        loadDBDataMI = new ContactsDBDataMImpl();
    }

    @Override
    public void loadData(Uri uri) {
        loadDBDataMI.loadData(uri, this);
    }

    @Override
    public void onLoadSuccess(List<Contact> contacts) {
        bindDataVI.bindData(contacts.get(0));
    }

    @Override
    public void onLoadError() {

    }
}
